import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';

import { map } from 'rxjs/operators';

@Injectable({
  providedIn: 'root',
})
export class WaterService {
  public water1URL = 'mock-data/water1.json';
  public water2URL = 'mock-data/water2.json';
  public water3URL = 'mock-data/water3.json';
  public water4URL = 'mock-data/water4.json';
  public water5URL = 'mock-data/water5.json';

  constructor(private http: HttpClient) {}
  getWater1() {
    return this.http
      .get<any>(this.water1URL)
      .pipe(map((data) => data['RECORDS']));
  }
  getWater2() {
    return this.http
      .get<any>(this.water2URL)
      .pipe(map((data) => data['RECORDS']));
  }
  getWater3() {
    return this.http
      .get<any>(this.water3URL)
      .pipe(map((data) => data['RECORDS']));
  }
  getWater4() {
    return this.http
      .get<any>(this.water4URL)
      .pipe(map((data) => data['RECORDS']));
  }
  getWater5() {
    return this.http
      .get<any>(this.water5URL)
      .pipe(map((data) => data['RECORDS']));
  }
}
